package com.zsrt.java.day20161223.xww.demo09;

import org.junit.Test;

public class Stars {

	/**
	 * 打印一个空心菱形
	 */
	@Test
	public void test09() {

		for(int top=1;top<=3;top++){
			System.out.print(" ");
		}
		System.out.println("*");
		for (int a = 1; a <= 3; a++) {
			for (int b = 1; b <= 7; b++) {
				if ((b != 4 - a) && (b != 4 + a)) {
					System.out.print(" ");
				} else {
					System.out.print("*");
				}
			}
			System.out.println();
		}
		for (int c = 1; c <= 2; c++) {
			for (int d = 1; d <= 7; d++) {
				if ((d != c + 1) && (d != 7 - c)) {
					System.out.print(" ");
				} else {
					System.out.print("*");
				}
			}
			System.out.println();
		}
		for(int top=1;top<=3;top++){
			System.out.print(" ");
		}
		System.out.println("*");
	}
}
